import {request} from '@/utils/request/request';
import type {UserListQueryParams} from './user.service.d';
const prefix = '/system/user';

// 查询用户列表
export function userListGET(queryParams: UserListQueryParams) {
  return request.get<any>({
    url: `${prefix}/list`,
    params: queryParams,
  });
}
// 查询部门下拉树结构
export function userDeptTreeGET() {
  return request.get<any>({
    url: `${prefix}/deptTree`,
  });
}

// 查询用户详细
export function userDetailGET(userId?: string) {
  if (!userId) {
    return request.get<any>({
      url: `${prefix}/`,
    });
  }
  return request.get<any>({
    url: `${prefix}/${userId}`,
  });
}
// 新增用户
export function userPOST(data: any) {
  return request.post<any>({
    url: `${prefix}`,
    data: data,
  });
}
// 修改用户
export function userPUT(data: any) {
  return request.put<any>({
    url: `${prefix}`,
    data: data,
  });
}
// 删除用户
export function userDELETE(userId: string) {
  return request.delete<any>({
    url: `${prefix}/${userId}`,
  });
}
// 用户密码重置
export function resetUserPwdPUT(data: {userId: string; password: string}) {
  return request.put<any>({
    url: `${prefix}/resetPwd`,
    data,
  });
}
// 用户状态修改
export function changeUserStatusPUT(data: {userId: string; status: string}) {
  return request.put<any>({
    url: `${prefix}/changeStatus`,
    data,
  });
}
